<!DOCTYPE html>
<html lang="en">
<head>
  
<meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title></title>
  <meta name="viewport" content="initial-scale=1, maximum-scale=1">
  <!-- <link rel="shortcut icon" href="http://favicon.ico"> -->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="viewport" content="width=device-width, height=device-height, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
  <meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">

  <link rel="stylesheet" href="https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/css/sm.min.css">
  <link rel="stylesheet" href="https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/css/sm-extend.min.css">
  <link rel="stylesheet" type="text/css" href="https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/css/register.css">
  <script type="text/javascript" src="https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/common/common/common.js"></script>
  <style>

    /*修改标题栏颜色*/
    .bar.bar-nav {
      background-color: #1FCA23;
    }

    /*修改标题栏字体颜色*/
    .bar.bar-nav .title {
      color: #fff;
    }
    
    /*修改工具栏背景颜色*/
    .bar.bar-tab {
      background-color: #FEEA4D;
    }
    /*修改内容区背景色*/
    .content{
    	background:#fff;
    }

  </style>
</head>
<body>
  
  <div class="page-group">
    <div class="page">
      <!-- 标题栏 -->
      <header class="bar bar-nav">
         <h1 class="title">登录</h1>
      </header>
      <!-- 页面内容区域 -->
      <div class="content">
         <!-- 登录 -->
         <form action="" method="post" id="login" name="login">
             <div class="loginphone" id="login_div_input" >
             	<input type="text" placeholder="手机号" id="login_user"/>
             </div>
             <p id="remind_1"></p>
             <div class="loginpwd" id="login_div_input2">
             	<input type="password" placeholder="密码" id="lgn_pwdipt"/>
             </div>
             <p id="remind_2"></p>       
                         
  	         <!-- 登录按钮 -->
             <a href="#" id="logbtn" class="themecolor" onclick="clklogbtn()">登录</a>
  	         <div class="log_list">
    	         	<a href="#" onclick="register()">注册账号</a>
    	         	<a href="#" onclick="forget()">忘记密码</a>
  	         </div>
         </form>

      </div>
    </div>
  </div>

  <!-- !-- 固定的js引用，所有的jQuery 要用 $$ 表示 --> 
<script type="text/javascript" src="https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/js/js/jquery-1.11.1.min.js"></script>
<!-- 这一行代码是为了 避免js冲突 -->
<script type="text/javascript">var $$ =jQuery.noConflict();</script>

<script type='text/javascript' src='https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/zepto/zepto/zepto.min.js' charset='utf-8'></script>
<script type='text/javascript' src='https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/js/js/sm.min.js' charset='utf-8'></script>
<!-- <script type='text/javascript' src='https://gitee.com/huaflower/CommonFile/raw/master/js/sm-extend.min.js' charset='utf-8'></script> -->
<!-- <script src="https://gitee.com/huaflower/ReadBook_CommonFile/raw/master/js/js/swiper/swiper.min.js"></script> -->
<script type="text/javascript">

	function register(){
     native_goto('local/register');
     
   };
   function forget(){
     native_goto('local/forget_password');
   };
  
  function clicklogin(){

    // 填写信息验证
    // 手机号验证
    $$('#login_user').blur(function(){
        reg =/^1[3|4|5|7|8][0-9]\d{4,8}$/i;
       if( $$(this).val()=="") { 
           $$("#remind_1").html("手机号不能为空！");
           return false;
        }
        else if($$(this).val().length<11) {   
 
          $$("#remind_1").html("手机号输入为11位数字");
          return false;
        }
        else if(!reg.test($$("#login_user").val())) { 
           $$("#remind_1").html("手机号不存在!");
           return false;
        }
        else {
   
           $$("#remind_1").html("");
        }
    });
    // $$('#login_user').focus(function(){
    //    setTimeout(function(){window.Keyboard.show();}, 10);
    // });
    // 密码验证
    $$('#lgn_pwdipt').blur(function(){
        reg=/^[\@A-Za-z0-9\!\#\$\%\^\&\*\.\~]{6,22}$/;
        if(!reg.test($$('#lgn_pwdipt').val())){

          $$("#remind_2").html("格式有误，请输入6~12位的数字、字母或特殊字符！");
          return false;
        }
        else 
        { 
          $$("#remind_2").html("");
        }
      });
  }
  // 登录信息验证
  function login(){

    var mobile = $$('#login_user').val();
    var password = $$('#lgn_pwdipt').val();
    if (!isNotNull(mobile)) {
      native_showdialog("手机号不能为空");
      return;
    }
    if (!isNotNull(password)) {
      native_showdialog("密码不能为空");
      return;
    }

    var param = { 
        mobile: mobile,
        password: password
    }
    var url = 'apis/login';
    net_request('post',url,param,loginSuccessCallBack,errorCallBack);
  }
  function loginSuccessCallBack(data){
    if (isNotNull(data) && data.success) {

       native_goto('local/home');
    }else{
       native_showdialog(data.message);
    }
  }


  function tempioslogin(){
    // native_goto('local/home');

    var param = { 
        mobile: '15210899700',
        password: '123456'
    }
    var url = 'apis/login';
    net_request('post',url,param,loginSuccessCallBack,errorCallBack);
  }
  
  function errorCallBack(data){
        
  }
  // 登录验证
  function clklogbtn(){
    login();
  }
 
  function getParams(data){
   // data需要转成json调用 ，函数urlParamParseJson();
     /*var jodata = JSON.parse(data); 
     if(isNotNull(jodata)){//
        
     }*/

  }	
    // 初始化
    $(function(){
      
      
      if(isIOS() && isIOSApply == '1') {
        //现在直接没有登录了，直接进行
        tempioslogin(); 
        // var tempiospasslogin = localStorage.getItem('tempiospasslogin');
        //   if(tempiospasslogin == '1' || tempiospasslogin == 1){
        //     localStorage.setItem('loginstate',1);
        //     clicklogin();    
        //   }else{
        //     tempioslogin(); 
            
        //   }
         
      }else{
        clicklogin();  
      }
      $.init();
      
    });
  </script>
</body>
</html>